<!-- 比赛 -->
<template>
	<view class="container">
		<view class="c-game">
			<view class="game-item" v-for="item in gameList" :key="item.id" @click="toGameDetail(item.id)" :style="{'background-image':`url(${baseURL + item.img})`}">
				<!-- <view class="p-game-item"></view>
				<view class="game-item-content">
					<text>{{item.name}}</text>
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"game",
		data() {
			return {
				// 比赛列表
				gameList:[]
			}
		},
		onLoad() {
			this.getGameList()
		},
		onShareAppMessage() {
			return {
				title: '潇湘键盘',
				path: '/pages/pages_index/game'
			}
		},
		onShareTimeline() {},
		methods: {
			// 获取比赛列表
			getGameList(){
				this.$http.getGameList().then(res=>{
					this.gameList = res
				})
			},
			// 跳转比赛详情页
			toGameDetail(id){
				uni.navigateTo({
					url:"/pages/pages_game/gameDetail?id="+id
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.container{
		.c-game{
			width: 100%;
			box-sizing: border-box;	
			.game-item{
				width: 100%;
				height: 350rpx;
				margin-top: 20rpx;
				box-sizing: border-box;
				border-radius: 15rpx;
				font-size: 55rpx;
				font-weight: bold;
				color: #fff;
				display: flex;
				align-items: center;
				justify-content: center;
				background-color: rgba(0, 0, 0, 0.17);
				background-size: 100%;
				background-color: #fff;
				box-shadow: 0 0 10rpx 0 rgba(0, 0, 0, 0.2);
				position: relative;
				
				.game-item-content {
					font-size: 55rpx;
					font-weight: bold;
					text-shadow: 3rpx 3rpx #333;
					color: #fff;
					position: absolute;
				}
				
				.p-game-item {
					width: 100%;
					height: 100%;
					background-color: rgba(0, 0, 0, 0.22);
					position: absolute;
				}
			}
		}
	}
</style>
